package com.ruoyi.applet.appletBanner.service.impl;

import com.ruoyi.applet.appletBanner.domain.AppletBanner;
import com.ruoyi.applet.appletBanner.mapper.AppletBannerMapper;
import com.ruoyi.applet.appletBanner.service.IAppletBannerService;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 小程序轮播图Service业务层处理
 * @author ruoyi
 * @date 2024-11-19
 */
@Service
public class AppletBannerServiceImpl implements IAppletBannerService {
    
    @Resource
    private AppletBannerMapper appletBannerMapper;
    
    /**
     * 查询小程序轮播图
     * @param id 小程序轮播图主键
     * @return 小程序轮播图
     */
    @Override
    public AppletBanner selectAppletBannerById(Long id) {
        return appletBannerMapper.selectAppletBannerById(id);
    }
    
    /**
     * 查询小程序轮播图列表
     * @param appletBanner 小程序轮播图
     * @return 小程序轮播图
     */
    @Override
    public List<AppletBanner> selectAppletBannerList(AppletBanner appletBanner) {
        return appletBannerMapper.selectAppletBannerList(appletBanner);
    }
    
    /**
     * 新增小程序轮播图
     * @param appletBanner 小程序轮播图
     * @return 结果
     */
    @Override
    public int insertAppletBanner(AppletBanner appletBanner) {
        appletBanner.setCreateTime(DateUtils.getNowDate());
        return appletBannerMapper.insertAppletBanner(appletBanner);
    }
    
    /**
     * 修改小程序轮播图
     * @param appletBanner 小程序轮播图
     * @return 结果
     */
    @Override
    public int updateAppletBanner(AppletBanner appletBanner) {
        appletBanner.setUpdateTime(DateUtils.getNowDate());
        return appletBannerMapper.updateAppletBanner(appletBanner);
    }
    
    /**
     * 批量删除小程序轮播图
     * @param ids 需要删除的小程序轮播图主键
     * @return 结果
     */
    @Override
    public int deleteAppletBannerByIds(String ids) {
        return appletBannerMapper.deleteAppletBannerByIds(Convert.toStrArray(ids));
    }
    
    /**
     * 删除小程序轮播图信息
     * @param id 小程序轮播图主键
     * @return 结果
     */
    @Override
    public int deleteAppletBannerById(Long id) {
        return appletBannerMapper.deleteAppletBannerById(id);
    }
    
    
    /**
     * 小程序 - 获取轮播图
     * @param appletBanner 条件
     * @return {@link List<AppletBanner>}
     */
    @Override
    public List<AppletBanner> selectAppletBannerListApplet(AppletBanner appletBanner) {
        return appletBannerMapper.selectAppletBannerListApplet(appletBanner);
    }
}
